<template>
  <div class="device-section">
    <div class="section-header">
      <el-icon><Microphone /></el-icon>
      <h2>门诊叫号系统</h2>
    </div>
    
    <div class="queue-system">
      <!-- 科室选择 -->
      <div class="department-selector">
        <el-radio-group v-model="selectedDepartment" size="large">
          <el-radio-button 
            v-for="dept in departments" 
            :key="dept.id" 
            :label="dept.id"
          >
            {{ dept.name }}
          </el-radio-button>
        </el-radio-group>
      </div>
      
      <!-- 当前叫号信息 -->
      <div class="current-call">
        <div class="call-header">当前就诊</div>
        <div class="call-info" v-if="currentCall.patient">
          <div class="patient-number">{{ currentCall.patient.number }}</div>
          <div class="patient-name">{{ currentCall.patient.name }}</div>
          <div class="room-info">{{ currentCall.room }}</div>
        </div>
        <div class="no-call" v-else>暂无叫号信息</div>
      </div>
      
      <!-- 等候队列 -->
      <div class="waiting-queue">
        <div class="queue-header">等候队列</div>
        <div class="queue-list">
          <div 
            v-for="patient in waitingPatients" 
            :key="patient.number"
            class="queue-item"
          >
            <span class="queue-number">{{ patient.number }}</span>
            <span class="queue-name">{{ patient.name }}</span>
            <span class="queue-status">{{ patient.status }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { Microphone } from '@element-plus/icons-vue'

// 门诊叫号系统数据
const selectedDepartment = ref(1)

const departments = ref([
  { id: 1, name: '内科' },
  { id: 2, name: '外科' },
  { id: 3, name: '儿科' },
  { id: 4, name: '妇产科' },
  { id: 5, name: '眼科' },
  { id: 6, name: '耳鼻喉科' }
])

// 模拟当前叫号信息
const currentCall = ref({
  patient: {
    number: 'A015',
    name: '张*明'
  },
  room: '内科诊室3'
})

// 模拟等候队列
const waitingPatients = ref([
  { number: 'A016', name: '李*华', status: '等候中' },
  { number: 'A017', name: '王*芳', status: '等候中' },
  { number: 'A018', name: '赵*伟', status: '等候中' },
  { number: 'A019', name: '刘*婷', status: '预约等候' },
  { number: 'A020', name: '陈*强', status: '预约等候' }
])
</script>

<style lang="scss" scoped>
.device-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ebeef5;
  
  h2 {
    margin: 0 0 0 10px;
    font-size: 18px;
    color: #303133;
  }
  
  .el-icon {
    font-size: 24px;
    color: #1a75bc;
  }
}

// 叫号系统样式
.queue-system {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.department-selector {
  margin-bottom: 20px;
  
  :deep(.el-radio-group) {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  :deep(.el-radio-button) {
    flex: 1;
    min-width: 80px;
    
    .el-radio-button__inner {
      width: 100%;
    }
  }
}

.current-call {
  background: linear-gradient(135deg, #1a75bc 0%, #0c4d8c 100%);
  color: white;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.call-header {
  font-size: 16px;
  margin-bottom: 15px;
  opacity: 0.9;
}

.call-info {
  .patient-number {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
  }
  
  .patient-name {
    font-size: 18px;
    margin-bottom: 10px;
  }
  
  .room-info {
    font-size: 14px;
    opacity: 0.8;
  }
}

.no-call {
  font-size: 16px;
  padding: 20px 0;
}

.waiting-queue {
  flex: 1;
  border: 1px solid #ebeef5;
  border-radius: 6px;
  overflow: hidden;
}

.queue-header {
  background: #f5f7fa;
  padding: 10px 15px;
  font-weight: 600;
  border-bottom: 1px solid #ebeef5;
}

.queue-list {
  max-height: 250px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 15px;
  border-bottom: 1px solid #ebeef5;
  
  &:last-child {
    border-bottom: none;
  }
  
  &:nth-child(odd) {
    background: #fafafa;
  }
}

.queue-number {
  font-weight: 600;
  color: #1a75bc;
}

.queue-name {
  flex: 1;
  margin-left: 15px;
}

.queue-status {
  color: #67c23a;
  font-size: 12px;
}

// 响应式设计
@media (max-width: 768px) {
  .department-selector {
    :deep(.el-radio-group) {
      flex-direction: column;
    }
  }
}
</style>